﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace PreBuildGrupyz.Extensions
{
    public static class TruncateTextHelper
    {
        public static string TruncateText(this HtmlHelper helper, string texto, int count)
        {
            if (texto.Length > count)
            {
                texto = texto.Substring(0, count);
                texto = texto.Substring(0, texto.LastIndexOf(' ')) + " (...)";
                return texto;
            }
            else return texto;
        }
    }
}